const mixTableData = (props) => {
	const { url, params = {}, limit = 5 } = props;
	return {
		data() {
			return {
				tableData: [{
					id: '',
					deviceNo: '',
					deviceName: '',
					alarmLevel: '',
					alarmDetails: '',
					department: '',
					installAddr: '',
					alarmTime: '',
					reset: '',
					handleStatus: '',
				}],
				list: null, //当前显示
				total: 0, //总条数
				current: 1, //当前显示页码
				limit,
			}
		},
		mounted() {
			this.init();
		},
		methods: {
			init: async function () {
				const result = await this.$axios({ url ,params });
				this.total = result.data.data.warnings.length;
				this.tableData = result.data.data.warnings;
				this.list = this.tableData.slice(
						 (this.current - 1) * this.limit,
						this.current * this.limit
				);
			}
		}
	}
}

export default mixTableData;